#define  _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>
using namespace std;



int main()
{
    string s;
    getline(cin, s);
    int end = s.size();
    int begin = s.rfind(' ');
    while (begin != end)
    {
        for (int i = begin + 1; i < end; i++)
        {
            printf("%c", s[i]);
        }
        printf(" ");
        end = begin;
        begin = s.rfind(' ', begin - 1);
    }

    return 0;
}